import React, { Component } from 'react';
// import { NavLink } from 'react-router-dom'
// import {Switch, Route, Redirect } from 'react-router-dom';
import Choiceness from './questions/choiceness';
import Newest from './questions/newest';
import Wait from './questions/wait';
import { Tabs, NavBar } from 'antd-mobile';
import style from './index.module.scss';
import './index.module.scss';

class Com extends Component {
  state = {
    tabs : [
      { title: '精选问答', key: 't1', com: <Choiceness /> },
      { title: '最新回答', key: 't2', com: <Newest /> },
      { title: '待回答问题', key: 't3', com: <Wait /> },
    ],
    com: <Choiceness />
  }
  render() {
    return (
      <div className={style.box} style={{overflow:"auto"}}>
        <header>
          <NavBar
            mode="light"
            icon={<span className="iconfont icon-fanhui" style={{ fontSize: '0.23rem', color: '#00B145' }}></span>}
            onLeftClick={() => this.props.history.go(-1)}
            rightContent={<span style={{color: '#00B145'}}>提问</span>}
          >
            <div className={style.search}>
              <input type="text" className={style.header_input} />
            </div>
          </NavBar>
        </header>
        <div className="content" >
            <div className={style.banner}>
              <ul>
                <li><img src="http://dummyimage.com/296x168" alt=""/></li>
                <li><img src="http://dummyimage.com/296x168" alt=""/></li>
                <li><img src="http://dummyimage.com/296x168" alt=""/></li>
                <li><img src="http://dummyimage.com/296x168" alt=""/></li>
              </ul>
            </div>
            <Tabs tabs={this.state.tabs} 
              initialPage={0} 
              animated={false} 
              useOnPan={false}
              onChange={(data)=>{
                this.setState({
                  com:data.com
                })
              }}
            >
              {this.state.com}
            </Tabs>
        </div>
      </div>
      
    );
  }
}

export default Com
